home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
HPAVC
/
HPAVC CD-ROM.iso
/
HFTUBE.ZIP
/
TUBEPIC.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1995-05-11
|
2KB
|
44 lines
Program TubePic;
{$M 4096,0,0}
Uses Crt;
Const OutputFile='TUBE.MAP';
BaseCol:Array[0..7] Of Byte=(62,63,126,127,190,191,254,255);
ColorDec=0.92;
Var Palette,NewPal:Array[0..767] Of Byte;
Line:Array[0..511] Of Byte;
Fil1,Fil2:File;
Wid,N,X:Word;
R,G,B:Real;
Hei,Y,ColCnt:Byte;
Begin
Asm Mov Ax,0003h; Int 10h; End;
If ParamCount=0 Then Begin
WriteLn('Usage: TubePic <picture file>'); Halt(0); End;
Assign(Fil1,ParamStr(1)); {$I-} Reset(Fil1,1);
If IOResult<>0 Then Begin WriteLn('File not found!'); Halt(1); End;
Assign(Fil2,OutputFile); ReWrite(Fil2,1);
BlockRead(Fil1,Palette,768); BlockRead(Fil1,Wid,2); BlockRead(Fil1,Hei,1);
For ColCnt:=0 to 7 Do Begin
R:=Palette[ColCnt*3+0]; G:=Palette[ColCnt*3+1]; B:=Palette[ColCnt*3+2];
For N:=0 to 31 Do Begin
NewPal[BaseCol[ColCnt]*3+0-N*6]:=Round(R);
NewPal[BaseCol[ColCnt]*3+1-N*6]:=Round(G);
NewPal[BaseCol[ColCnt]*3+2-N*6]:=Round(B);
R:=R*ColorDec; G:=G*ColorDec; B:=B*ColorDec;
End;
End;
BlockWrite(Fil2,NewPal,768); BlockWrite(Fil2,Wid,2); BlockWrite(Fil2,Hei,1);
For Y:=0 to Hei-1 Do Begin
BlockRead(Fil1,Line,Wid);
For X:=0 to Wid-1 Do Line[X]:=BaseCol[Line[X]];
BlockWrite(Fil2,Line,Wid); End;
Close(Fil2); Close(Fil1);
Asm Mov Ax,0013h; Int 10h; End;
Port[$3C8]:=0; For N:=0 to 767 Do Port[$3C9]:=NewPal[N];
For N:=0 to 255 Do For Y:=0 to 199 Do Mem[$A000:Y*320+N]:=N;
Repeat Until KeyPressed;
Asm Mov Ax,0003h; Int 10h; End;
End.